﻿namespace AhpilyServer.TimerUtil
{
    /// <summary>
    /// 需要定时完成的委托
    /// </summary>
    public delegate void TimerDelegate();

    /// <summary>
    /// 定时器任务的数据模型
    /// </summary>
    public class TimerModel
    {
        public readonly int Id;

        public readonly long Time;

        private TimerDelegate OnFinish;

        public TimerModel(int id, long time, TimerDelegate onFinish)
        {
            Id = id;
            Time = time;
            OnFinish = onFinish;
        }

        /// <summary>
        /// 触发任务
        /// </summary>
        public void Run()
        {
            OnFinish();
        }
    }
}
